//
//  CBJComposeBtn.swift
//  Weibo
//
//  Created by 崔健 on 16/5/28.
//  Copyright © 2016年 cbj. All rights reserved.
//

import UIKit

class CBJComposeBtn: UIButton {


    let imageWidth : CGFloat = 80
    
    var composeItem : CBJCompose?{
    
        didSet{
        
            setTitle(composeItem?.title, forState: .Normal)
            setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
            titleLabel?.font = UIFont.systemFontOfSize(14)
            setImage(UIImage.init(named: (composeItem?.icon)!),forState: .Normal)
            titleLabel?.textAlignment = .Center
            
        }
    }
    
    override func titleRectForContentRect(contentRect: CGRect) -> CGRect {
        
        return CGRect(x: 0, y: imageWidth, width: imageWidth, height: contentRect.height - imageWidth)
    }
    
    override func imageRectForContentRect(contentRect: CGRect) -> CGRect {
        
        return CGRect(x: 0, y: 0, width: imageWidth, height: imageWidth)
    }
    

    

}
